<template>
  <div class="transactionAudit">
    <el-dialog :title="title" width="1500px" :visible="true" :gutter="24" @close="close">
      <template>线路：{{lineCode}} 站点：{{stationCode}} 售票员：{{conductorName}} 售票员工号：{{conductorCode}} 设备操作号：{{deviceOperateNum}}  BOM编号：{{bomCode}}  &nbsp;&nbsp;免费出站发售数量：{{scFreeNum}}  &nbsp;&nbsp;特殊车票发售数量：{{scSpecialNum}} &nbsp;&nbsp;付费车票数量：{{scMoneyNum}} &nbsp;付费车票金额：{{scMoneyNum}} </template><br><br>
      <template>
        <el-button
          id="XJSW"
          class="filter-item"
          type="primary"
          size="mini"
          @click="getSwStInputPassengerWorkCash()">现金事务
        </el-button>
        <el-button
          id="GZTK"
          class="filter-item"
          type="primary"
          size="mini"
          @click="getSwStInputPassengerWorkRefund()">故障退款
        </el-button>
        <el-button
          id="QT"
          class="filter-item"
          type="primary"
          size="mini"
          @click="getSwStInputPassengerWorkOther(8)">其它相关数据录入
        </el-button>
        <el-button
          id="DZ"
          class="filter-item"
          type="primary"
          size="mini"
          @click="getSwStInputPassengerWorkElectron()">电子事务
        </el-button>
        <el-button
          id="FF"
          class="filter-item"
          type="primary"
          size="mini"
          @click="getSwStInputPassengerWorkPay()">付费出站发售
        </el-button>
        <el-button
          id="TS"
          class="filter-item"
          type="primary"
          size="mini"
          @click="getSwStInputPassengerWorkSpecial()">特殊车票发售
        </el-button>
        <el-button
          id="MF"
          class="filter-item"
          type="primary"
          size="mini"
          @click="getSwStInputPassengerWorkFree()">免费出站发售
        </el-button>
        <el-button
          id="JS"
          class="filter-item"
          type="primary"
          size="mini"
          @click="getSwStInputPassengerWorkTicket(0)">即时退换票
        </el-button>
        <el-button
          id="FJS"
          class="filter-item"
          type="primary"
          size="mini"
          @click="getSwStInputPassengerWorkTicket(1)">非即时退换票
        </el-button>
      </template>
      <basic-container>

        <avue-crud
          v-show="showType==2"
          ref="crud2"
          :option="swStInputPassengerWorkElectronOption"
          :data="swStInputPassengerWorkElectronList"
          :table-loading="listLoading"
          @selection-change="selectionChange"
          @on-load="getSwStInputPassengerWorkElectron">
          <template slot="filePath" slot-scope="scope">
            <el-button
              class="filter-item"
              type="primary"
              size="mini" @click="download(scope.row.filePath)">下载</el-button>
          </template>
          <template slot-scope="scope" slot="menuRight">
            <el-button v-show="btnType!=2" type="primary"  size="mini" @click="submit">审批通过</el-button>
            <el-button type="primary"  size="mini" @click="addReport(2)">加入报表差错</el-button>
            <el-button type="primary" v-show="btnType!=2" size="mini" @click="addCC(2)">加入票款差异</el-button>
          </template>
          <template v-show="btnType!=2" slot-scope="scope" slot="menu">
            <el-button type="text" size="small" plain @click.stop="previewEditor(scope.row,2)">审批不通过</el-button>
          </template>
        </avue-crud>

        <avue-crud
          v-show="showType==3"
          ref="crud3"
          :option="swStInputPassengerWorkPayOption"
          :data="swStInputPassengerWorkPayList"
          :table-loading="listLoading"
          @selection-change="selectionChange"
          @on-load="getSwStInputPassengerWorkPay">
          <template slot="filePath" slot-scope="scope">
            <el-button
              class="filter-item"
              type="primary"
              size="mini" @click="download(scope.row.filePath)">下载</el-button>
          </template>
          <template slot-scope="scope" slot="menuRight">
            <el-button v-show="btnType!=2" type="primary"  size="mini" @click="submit">审批通过</el-button>
            <el-button type="primary"  size="mini" @click="addReport(3)">加入报表差错</el-button>
            <el-button type="primary" v-show="btnType!=2" size="mini" @click="addCC(2)">加入票款差异</el-button>
          </template>
          <template v-show="btnType!=2" slot-scope="scope" slot="menu">
            <el-button type="text" size="small" plain @click.stop="previewEditor(scope.row,3)">审批不通过</el-button>
          </template>
        </avue-crud>

        <avue-crud
          v-show="showType==4"
          ref="crud4"
          :option="swStInputPassengerWorkSpecialOption"
          :data="swStInputPassengerWorkSpecialList"
          :table-loading="listLoading"
          @selection-change="selectionChange"
          @on-load="getSwStInputPassengerWorkSpecial">
          <template slot="filePath" slot-scope="scope">
            <el-button
              class="filter-item"
              type="primary"
              size="mini" @click="download(scope.row.filePath)">下载</el-button>
          </template>
          <template slot-scope="scope" slot="menuRight">
            <el-button v-show="btnType!=2" type="primary"  size="mini" @click="submit">审批通过</el-button>
            <el-button type="primary"  size="mini" @click="addReport(4)">加入报表差错</el-button>
            <!--<el-button type="primary" v-show="btnType!=2" size="mini" @click="addCC(2)">加入票款差异</el-button>-->
          </template>
          <template v-show="btnType!=2" slot-scope="scope" slot="menu">
            <el-button type="text" size="small" plain @click.stop="previewEditor(scope.row,4)">审批不通过</el-button>
          </template>
        </avue-crud>

        <avue-crud
          v-show="showType==5"
          ref="crud5"
          :option="swStInputPassengerWorkFreeOption"
          :data="swStInputPassengerWorkFreeList"
          :table-loading="listLoading"
          @selection-change="selectionChange"
          @on-load="getSwStInputPassengerWorkFree">
          <template slot="filePath" slot-scope="scope">
            <el-button
              class="filter-item"
              type="primary"
              size="mini" @click="download(scope.row.filePath)">下载</el-button>
          </template>
          <template slot-scope="scope" slot="menuRight">
            <el-button v-show="btnType!=2" type="primary"  size="mini" @click="submit">审批通过</el-button>
            <el-button type="primary"  size="mini" @click="addReport(5)">加入报表差错</el-button>
            <!--<el-button type="primary" v-show="btnType!=2" size="mini" @click="addCC(2)">加入票款差异</el-button>-->
          </template>
          <template v-show="btnType!=2" slot-scope="scope" slot="menu">
            <el-button type="text" size="small" plain @click.stop="previewEditor(scope.row,5)">审批不通过</el-button>
          </template>
        </avue-crud>

        <avue-crud
          v-show="showType==6"
          ref="crud6"
          :option="swStInputPassengerWorkRefundOption"
          :data="swStInputPassengerWorkRefundList"
          :table-loading="listLoading"
          @selection-change="selectionChange"
          @on-load="getSwStInputPassengerWorkRefund">
          <template slot="filePath" slot-scope="scope">
            <el-button
              class="filter-item"
              type="primary"
              size="mini" @click="download(scope.row.filePath)">下载</el-button>
          </template>
          <template slot-scope="scope" slot="menuRight">
            <el-button v-show="btnType!=2" type="primary"  size="mini" @click="submit">审批通过</el-button>
            <el-button type="primary" size="mini" @click="addReport(6)">加入报表差错</el-button>
            <el-button type="primary" v-show="btnType!=2" size="mini" @click="addCC(2)">加入票款差异</el-button>
          </template>
          <template v-show="btnType!=2" slot-scope="scope" slot="menu">
            <el-button type="text" size="small" plain @click.stop="previewEditor(scope.row,6)">审批不通过</el-button>
          </template>
        </avue-crud>

        <avue-crud
          v-show="showType==7"
          ref="crud7"
          :option="swStInputPassengerWorkTicketOption"
          :data="swStInputPassengerWorkTicketList"
          :table-loading="listLoading"
          @selection-change="selectionChange"
          @on-load="getSwStInputPassengerWorkTicket">
          <template slot="filePath" slot-scope="scope">
            <el-button
              class="filter-item"
              type="primary"
              size="mini" @click="download(scope.row.filePath)">下载</el-button>
          </template>
          <template slot-scope="scope" slot="menuRight">
            <el-button v-show="btnType!=2" type="primary"  size="mini" @click="submit">审批通过</el-button>
            <el-button type="primary"  size="mini" @click="addReport(7)">加入报表差错</el-button>
            <el-button type="primary" v-show="btnType!=2" size="mini" @click="addCC(2)">加入票款差异</el-button>
          </template>
          <template v-show="btnType!=2" slot-scope="scope" slot="menu">
            <el-button type="text" size="small" plain @click.stop="previewEditor(scope.row,7)">审批不通过</el-button>
          </template>
        </avue-crud>

        <avue-crud
          v-show="showType==8"
          ref="crud8"
          :option="swStInputPassengerWorkOtherOption"
          :data="swStInputPassengerWorkOtherList"
          :table-loading="listLoading"
          @selection-change="selectionChange"
          @on-load="getSwStInputPassengerWorkOther">
          <template slot-scope="scope" slot="menuRight">
            <el-button v-show="btnType!=2" type="primary"  size="mini" @click="submit">审批通过</el-button>
            <el-button type="primary"  size="mini" @click="addReport(8)">加入报表差错</el-button>
            <el-button type="primary" v-show="btnType!=2" size="mini" @click="addCC(2)">加入票款差异</el-button>
          </template>
          <template v-show="btnType!=2" slot-scope="scope" slot="menu">
            <el-button type="text" size="small" plain @click.stop="previewEditor(scope.row,8)">审批不通过</el-button>
          </template>
        </avue-crud>
        <avue-crud
          v-show="showType==1"
          ref="crud1"
          :option="swStInputPassengerWorkCashOption"
          :data="swStInputPassengerWorkCashList"
          :table-loading="listLoading"
          @selection-change="selectionChange"
          @on-load="getSwStInputPassengerWorkCash">
          <template slot="filePath" slot-scope="scope">
            <el-button
              class="filter-item"
              type="primary"
              size="mini" @click="download(scope.row.filePath)">下载</el-button>
          </template>
          <template slot-scope="scope" slot="menuRight">
            <el-button v-show="btnType!=2" type="primary"  size="mini" @click="submit">审批通过</el-button>
            <el-button type="primary"  size="mini" @click="addReport(1)">加入报表差错</el-button>
            <el-button type="primary" v-show="btnType!=2" size="mini" @click="addCC(2)">加入票款差异</el-button>
          </template>
          <template v-show="btnType!=2" slot-scope="scope" slot="menu">
            <el-button type="text" size="small" plain @click.stop="previewEditor(scope.row,1)">审批不通过</el-button>
          </template>
        </avue-crud>
      </basic-container>
    </el-dialog>
    <el-dialog
      :visible.sync="previewEditorVisible"
      width="500px" >
      <el-form :inline="true" class="demo-form-inline" ref="refname" label-width="120px">
        <el-form-item label="原因：" style="margin-left: 20px">
          <el-input style="width: 300px" type="textarea" v-model="reason"></el-input>
        </el-form-item>
        <el-form-item label="正确金额：" style="margin-left: 20px">
          <el-input style="width: 300px" type="textarea" v-model="auditAmount" oninput="value=value.replace(/[^\-?\d.]/g,'')"></el-input>
        </el-form-item>
      </el-form>
      <template slot="footer">
        <center>
          <el-button type="primary" size="small"
                     @click="submitForm">确认
          </el-button>
          <el-button size="small"
                     @click="previewEditorVisible=false">取消</el-button>
        </center>
      </template>
    </el-dialog>

    <addReportEditor ref="addReportEditor" @addReportSuccess="refreshList"></addReportEditor>
  </div>
</template>

<script>
  import {getForm, postForm} from '@/api/gen/gen';
  import { handleDown } from '@/util/util';
  import {swStInputPassengerWorkCashOption,getSwStInputPassengerWorkCash,
    swStInputPassengerWorkElectronOption,getSwStInputPassengerWorkElectron,
    swStInputPassengerWorkPayOption,getSwStInputPassengerWorkPay,
    swStInputPassengerWorkSpecialOption,getSwStInputPassengerWorkSpecial,
    swStInputPassengerWorkFreeOption,getSwStInputPassengerWorkFree,
    swStInputPassengerWorkRefundOption,getSwStInputPassengerWorkRefund,
    swStInputPassengerWorkTicketOption,getSwStInputPassengerWorkTicket,
    swStInputPassengerWorkOtherOption,getSwStInputPassengerWorkOther,
    updateTransactionAudit,updateTransactionAuditToF,updateTransactionAuditToPKCY,
    queryCKSWCount,
    queryScTicketCountAndMoney
  } from '../../../../../api/subwayRat/conductorDifferences/passengersTransaction/passengersTransactionAudit/transactionAudit';
  import ElInput from "../../../../../../node_modules/element-ui/packages/input/src/input";
  import addReportEditor from '@/views/subwayRat/reportMondify/reportMistakeInfo/Editor';
  import {fenExYuangettoFixed2, numToTwoPoint} from "../../../../../api/subwayRat/commonCheck";
  export default {
    components: {ElInput,addReportEditor},
    name: 'transactionAudit',
    data() {
      return {
        title : '',
        reason : '',
        auditAmount : '',
        lineCode : '',
        stationCode : '',
        conductorName : '',
        conductorCode : '',
        listLoading: true,
        previewEditorVisible: false,
        swStInputPassengerWorkCashOption: swStInputPassengerWorkCashOption,//option
        swStInputPassengerWorkCashList : [],
        swStInputPassengerWorkElectronOption: swStInputPassengerWorkElectronOption,
        swStInputPassengerWorkElectronList : [],
        swStInputPassengerWorkPayOption: swStInputPassengerWorkPayOption,
        swStInputPassengerWorkPayList : [],
        swStInputPassengerWorkSpecialOption: swStInputPassengerWorkSpecialOption,
        swStInputPassengerWorkSpecialList : [],
        swStInputPassengerWorkFreeOption: swStInputPassengerWorkFreeOption,
        swStInputPassengerWorkFreeList : [],
        swStInputPassengerWorkRefundOption: swStInputPassengerWorkRefundOption,
        swStInputPassengerWorkRefundList : [],
        swStInputPassengerWorkTicketOption: swStInputPassengerWorkTicketOption,
        swStInputPassengerWorkTicketList : [],
        swStInputPassengerWorkOtherOption: swStInputPassengerWorkOtherOption,
        swStInputPassengerWorkOtherList : [],
        selectKeys:[], //存放对像
        selectKeyVals:[], //存放值
        operationType : 0,
        showType : 1,
        url : '',
        btnType : 0,
        srcList : [],
        row:{},
        relationtype : 0
      }
    },
    computed: {
    },
    watch: {
    },
    created() {
      let id = this.$parent.rowData.id;
      let conductorCode = this.$parent.rowData.conductorCode;
      let handleTime = this.$parent.rowData.workDate;
      let lineCode = this.$parent.rowData.lineCode;
      let stationCode = this.$parent.rowData.stationCode;
      let deviceOperateNum = this.$parent.rowData.deviceOperateNum;
      let bomCode = this.$parent.rowData.bomCode;
      let p = {
        id : id,
        conductorCode : conductorCode,
        handleTime : handleTime,
        lineCode : lineCode,
        stationCode : stationCode
      };
      queryCKSWCount(p).then((response)=>{
        let swStInputPassengerWorkCash = response.data.swStInputPassengerWorkCash;
        if(0!=swStInputPassengerWorkCash){
          document.getElementById('XJSW').style.color = 'red';
        }
        let swStInputPassengerWorkElectron = response.data.swStInputPassengerWorkElectron;
        if(0!=swStInputPassengerWorkElectron){
          document.getElementById('DZ').style.color = 'red';
        }
        let swStInputPassengerWorkPay = response.data.swStInputPassengerWorkPay;
        if(0!=swStInputPassengerWorkPay){
          document.getElementById('FF').style.color = 'red';
        }
        let swStInputPassengerWorkSpecial = response.data.swStInputPassengerWorkSpecial;
        if(0!=swStInputPassengerWorkSpecial){
          document.getElementById('TS').style.color = 'red';
        }
        let swStInputPassengerWorkFree = response.data.swStInputPassengerWorkFree;
        if(0!=swStInputPassengerWorkFree){
          document.getElementById('MF').style.color = 'red';
        }
        let swStInputPassengerWorkRefund = response.data.swStInputPassengerWorkRefund;
        if(0!=swStInputPassengerWorkRefund){
          document.getElementById('GZTK').style.color = 'red';
        }
        let swStInputPassengerWorkTicket1 = response.data.swStInputPassengerWorkTicket1;
        if(0!=swStInputPassengerWorkTicket1){
          document.getElementById('JS').style.color = 'red';
        }
        let swStInputPassengerWorkTicket = response.data.swStInputPassengerWorkTicket;
        if(0!=swStInputPassengerWorkTicket){
          document.getElementById('FJS').style.color = 'red';
        }
        let swStInputPassengerWorkOther = response.data.swStInputPassengerWorkOther;
        if(0!=swStInputPassengerWorkOther){
          document.getElementById('QT').style.color = 'red';
        }
        
      });
      let scp = {
        conductorCode : conductorCode,
        handleTime : handleTime,
        lineCode : lineCode,
        stationCode : stationCode,
	deviceOperateNum : this.$parent.rowData.deviceOperateNum,
        bomCode : this.$parent.rowData.bomCode
      };
      queryScTicketCountAndMoney(scp).then((response)=>{
         let sc_free_num = response.data.sc_free_num;
	 let sc_free_amount = response.data.sc_free_amount; 
	 let sc_special_num = response.data.sc_special_num;
	 let sc_money_num = response.data.sc_money_num;
	 let sc_money_amount = response.data.sc_money_amount;
	 if(null!=sc_free_num){
          this.scFreeNum = sc_free_num;
         }
	 if(null!=sc_free_amount){
          this.scFreeAmount= sc_free_amount;
         }
	 if(null!=sc_special_num){
          this.scSpecialNum = sc_special_num;
         }
	 if(null!=sc_money_num){
          this.scMoneyNum = sc_money_num;
         }
         if(null!=sc_money_amount){
          this.scMoneyAmount = sc_money_amount;
         }       
        
      });
      this.btnType = this.$parent.btnType;
      this.lineCode = this.$parent.rowData.$lineCode;
      this.stationCode = this.$parent.rowData.$stationCode;
      this.conductorName = this.$parent.rowData.conductorName;
      this.conductorCode = this.$parent.rowData.conductorCode;
      this.deviceOperateNum = this.$parent.rowData.deviceOperateNum;
      this.bomCode = this.$parent.rowData.bomCode;
    },
    mounted() {
    },
    methods: {
        
        addCC(type){
          if(this.selectKeys.length<=0 || this.selectKeys.length>1){
            this.$message.warning("请选择要加入的数据并且只选择一条！");
            return;
          }
	  
          if(1!=type && 3!=this.selectKeys[0].auditStatus){
            this.$message.warning("请选择审批未通过数据加入！");
            return;
          }
          if(1==type){//加入报表差错
            this.selectKeys[0].lineCode = this.$parent.rowData.lineCode;
            this.selectKeys[0].stationCode = this.$parent.rowData.stationCode;
            this.selectKeys[0].workDate = this.$parent.rowData.workDate;
            this.selectKeys[0].reportNameId = '2'; //乘客事务
            let number = this.selectKeys[0].auditAmount;
            if(number == undefined)
              number = this.selectKeys[0].auditNumber;
            this.selectKeys[0].errorDetail = "差异原因为：" + (this.selectKeys[0].reason?this.selectKeys[0].reason:'') + ",正确金额/次数为：" + (number?number:''); //乘客事务
            this.$router.push({ path: '/subwayRat/reportMondify/reportMistakeInfo',query:{row:this.selectKeys[0]}})
          }else{//加入票款差异
            let p = this.selectKeys[0];
            p.lineCode = this.$parent.rowData.lineCode;
            p.stationCode = this.$parent.rowData.stationCode;
            p.workDate = this.$parent.rowData.workDate;
            p.conductorCode = this.$parent.rowData.conductorCode;
            updateTransactionAuditToPKCY(p).then((res)=>{
              if(res.data.code==0){
                this.$message.success("操作成功！");
              }else if(res.data.code!=0){
                this.$message.warning(res.data.msg);
              }
            });
          }
      },
      async submitForm(){
        let p = {
          id : this.row.id,
          parentId : this.$parent.rowData.id,
          relationtype : this.relationtype,
          reason:this.reason,
          auditAmount:this.auditAmount,
          lineCode : this.$parent.rowData.lineCode,
          stationCode : this.$parent.rowData.stationCode,
          conductorName : this.conductorName,
          conductorCode : this.conductorCode
        };
        await updateTransactionAuditToF(p).then((res)=>{
          if(res.data.code==0){
            this.$message.success("操作成功！");
          }else{
            this.$message.error("操作失败！");
          }
        });

        if(1==this.showType){
            this.getSwStInputPassengerWorkCash();
        }else if(2==this.showType){
            this.getSwStInputPassengerWorkElectron();
        }else if(3==this.showType){
            this.getSwStInputPassengerWorkPay();
        }else if(4==this.showType){
            this.getSwStInputPassengerWorkSpecial();
        }else if(5==this.showType){
            this.getSwStInputPassengerWorkFree();
        }else if(6==this.showType){
            this.getSwStInputPassengerWorkRefund();
        }else if(7==this.showType){
            this.getSwStInputPassengerWorkTicket();
        }else if(8==this.showType){
            this.getSwStInputPassengerWorkOther();
        }
        this.reason = '';
        this.auditAmount = '';
        this.previewEditorVisible = false;
      },
      previewEditor(row,type){
        if(1!=row.auditStatus){
          this.$message.warning("请选择未审批的数据！");
          return;
        }
        this.reason = '';
        this.auditAmount = '';
        this.previewEditorVisible = true;
        this.row = row;
        this.relationtype = type;
      },
      submit(){
        if(this.selectKeys.length<=0){
          this.$message.warning("请选择要审批的数据！");
          return;
        }
        for(let i=0;i<this.selectKeys.length;i++){
          if(3 == this.selectKeys[i].auditStatus){
            this.$message.warning("勾选数据中存在审批不通过数据数据！");
            return
          }
        }
        if(this.selectKeys[0].operationType != undefined && this.selectKeys[0].operationType != ''){
          this.operationType = this.selectKeys[0].operationType;
        }
        debugger
        let p = {
          ids : JSON.stringify(this.selectKeyVals),
          type : this.showType,
          relationId : this.$parent.rowData.id,
          lineCode : this.$parent.rowData.lineCode,
          stationCode : this.$parent.rowData.stationCode,
          handlePersonCode : this.$parent.rowData.conductorCode,
          handleTime : this.$parent.rowData.workDate
        };
        updateTransactionAudit(p).then((res)=>{
          if(res.data.code==0){
            this.$message.success("操作成功！");
            this.refreshList();
          }else{
            this.$message.error("操作失败！");
          }
        });
        // this.close(); //先去掉
      },
      // download(row){
      //   if(row && row != ''){
      //     handleDown(row,"zdkj")
      //   }
      // },
      //图片附件下载
      download(row) {
        let pathList = [];
          if (!this.validatenull(row.filePath)) {
            pathList.push(row.filePath);
          }
          if (pathList[0] == "[]" || pathList[0] == undefined || pathList[0] == null) {
            this.$message.info("无附件");
            return;
          }
          handleDownloadZip(pathList, "乘客事务图片附件.zip");
      },
      getSwStInputPassengerWorkCash() {
        this.selectKeys=[];
        this.selectKeyVals=[];
        this.showType = 1;
        this.title = '现金事务';
        this.listLoading = true;
        let id = this.$parent.rowData.id;
        getSwStInputPassengerWorkCash({relationId : id}).then((response)=>{
            this.swStInputPassengerWorkCashList = response.data.data
            this.listLoading = false
        });
        if(1!=this.btnType){
          this.swStInputPassengerWorkCashOption.menu = false;
        }else{
          this.swStInputPassengerWorkCashOption.menu = true;
        }
//        if(3!=this.btnType){
//          this.swStInputPassengerWorkCashOption.column[this.swStInputPassengerWorkCashOption.column.length-1].hide = true;
//          this.swStInputPassengerWorkCashOption.column[this.swStInputPassengerWorkCashOption.column.length-2].hide = true;
//        }
      },
      getSwStInputPassengerWorkElectron() {
        this.selectKeys=[];
        this.selectKeyVals=[];
        this.showType = 2;
        this.title = '电子事务';
        this.listLoading = true;
        let id = this.$parent.rowData.id;
        getSwStInputPassengerWorkElectron({relationId : id}).then((response)=>{
          this.swStInputPassengerWorkElectronList = response.data.data
          this.listLoading = false
        });
        if(1!=this.btnType){
          this.swStInputPassengerWorkElectronOption.menu = false;
        }else{
          this.swStInputPassengerWorkElectronOption.menu = true;
        }
//        if(3!=this.btnType){
//          this.swStInputPassengerWorkElectronOption.column[this.swStInputPassengerWorkElectronOption.column.length-1].hide = true;
//          this.swStInputPassengerWorkElectronOption.column[this.swStInputPassengerWorkElectronOption.column.length-2].hide = true;
//        }
      },
      getSwStInputPassengerWorkPay() {
        this.selectKeys=[];
        this.selectKeyVals=[];
        this.showType = 3;
        this.title = '付费出站发售事务';
        this.listLoading = true;
        let id = this.$parent.rowData.id;
        getSwStInputPassengerWorkPay({relationId : id,row:JSON.stringify(this.$parent.rowData)}).then((response)=>{
          this.swStInputPassengerWorkPayList = response.data.data;
          this.listLoading = false;
          console.log(this.swStInputPassengerWorkPayOption, this.swStInputPassengerWorkPayList);
        });

        if(1!=this.btnType){
          this.swStInputPassengerWorkPayOption.menu = false;
        }else{
          this.swStInputPassengerWorkPayOption.menu = true;
        }
//        if(3!=this.btnType){
//          this.swStInputPassengerWorkPayOption.column[this.swStInputPassengerWorkPayOption.column.length-1].hide = true;
//          this.swStInputPassengerWorkPayOption.column[this.swStInputPassengerWorkPayOption.column.length-2].hide = true;
//        }

      },
      getSwStInputPassengerWorkSpecial() {
        this.selectKeys=[];
        this.selectKeyVals=[];
        this.showType = 4;
        this.title = '特殊车票发售事务';
        this.listLoading = true;
        let id = this.$parent.rowData.id;
        getSwStInputPassengerWorkSpecial({relationId : id}).then((response)=>{
          this.swStInputPassengerWorkSpecialList = response.data.data
          this.listLoading = false
        });
        if(1!=this.btnType){
          this.swStInputPassengerWorkSpecialOption.menu = false;
        }else{
          this.swStInputPassengerWorkSpecialOption.menu = true;
        }
//        if(3!=this.btnType){
//          this.swStInputPassengerWorkSpecialOption.column[this.swStInputPassengerWorkSpecialOption.column.length-1].hide = true;
//          this.swStInputPassengerWorkSpecialOption.column[this.swStInputPassengerWorkSpecialOption.column.length-2].hide = true;
//        }
      },
      getSwStInputPassengerWorkFree() {
        this.selectKeys=[];
        this.selectKeyVals=[];
        this.showType = 5;
        this.title = '免费出站发售事务';
        this.listLoading = true;
        let id = this.$parent.rowData.id;
        getSwStInputPassengerWorkFree({relationId : id,row:JSON.stringify(this.$parent.rowData)}).then((response)=>{
          this.swStInputPassengerWorkFreeList = response.data.data
          this.listLoading = false
        });
        if(1!=this.btnType){
          this.swStInputPassengerWorkFreeOption.menu = false;
        }else{
          this.swStInputPassengerWorkFreeOption.menu = true;
        }
//        if(3!=this.btnType){
//          this.swStInputPassengerWorkFreeOption.column[this.swStInputPassengerWorkFreeOption.column.length-1].hide = true;
//          this.swStInputPassengerWorkFreeOption.column[this.swStInputPassengerWorkFreeOption.column.length-2].hide = true;
//        }
      },
      getSwStInputPassengerWorkRefund() {
        this.selectKeys=[];
        this.selectKeyVals=[];
        this.showType = 6;
        this.title = '故障退款事务';
        this.listLoading = true;
        let id = this.$parent.rowData.id;
        getSwStInputPassengerWorkRefund({relationId : id}).then((response)=>{
          this.swStInputPassengerWorkRefundList = response.data.data
          this.listLoading = false
        });
        if(1!=this.btnType){
          this.swStInputPassengerWorkRefundOption.menu = false;
        }else{
          this.swStInputPassengerWorkRefundOption.menu = true;
        }
//        if(3!=this.btnType){
//          this.swStInputPassengerWorkRefundOption.column[this.swStInputPassengerWorkRefundOption.column.length-1].hide = true;
//          this.swStInputPassengerWorkRefundOption.column[this.swStInputPassengerWorkRefundOption.column.length-2].hide = true;
//        }
      },
      getSwStInputPassengerWorkTicket(operationType) {
        this.selectKeys=[];
        this.selectKeyVals=[];
        this.showType = 7;
        this.title = '即时退换票';
        if(1 == operationType){
          this.title = '非即时退换票';
        }
        this.listLoading = true;
        let conductorCode = this.$parent.rowData.conductorCode;
        let handleTime = this.$parent.rowData.workDate;
        getSwStInputPassengerWorkTicket({handlePersonCode : conductorCode,handleTime:handleTime,operationType:operationType}).then((response)=>{
          this.swStInputPassengerWorkTicketList = response.data.data
          this.listLoading = false
        });
        if(1!=this.btnType){
          this.swStInputPassengerWorkTicketOption.menu = false;
        }else{
          this.swStInputPassengerWorkTicketOption.menu = true;
        }
//        if(3!=this.btnType){
//          this.swStInputPassengerWorkTicketOption.column[this.swStInputPassengerWorkTicketOption.column.length-1].hide = true;
//          this.swStInputPassengerWorkTicketOption.column[this.swStInputPassengerWorkTicketOption.column.length-2].hide = true;
//        }
      },
      getSwStInputPassengerWorkOther(operationType) {
        this.selectKeys=[];
        this.selectKeyVals=[];
        this.showType = 8;
        this.title = '其相关数据录入';
        this.listLoading = true;
        let conductorCode = this.$parent.rowData.conductorCode;
        let handleTime = this.$parent.rowData.workDate;
        let lineCode = this.$parent.rowData.lineCode;
        let stationCode = this.$parent.rowData.stationCode;
        getSwStInputPassengerWorkOther({conductorCode : conductorCode,inputTime:handleTime,lineCode:lineCode,stationCode:stationCode}).then((response)=>{
          this.swStInputPassengerWorkOtherList = response.data.data
          this.listLoading = false
        });

        if(1!=this.btnType){
          this.swStInputPassengerWorkOtherOption.menu = false;
        }else{
          this.swStInputPassengerWorkOtherOption.menu = true;
        }
//        if(3!=this.btnType){
//          this.swStInputPassengerWorkOtherOption.column[this.swStInputPassengerWorkOtherOption.column.length-1].hide = true;
//          this.swStInputPassengerWorkOtherOption.column[this.swStInputPassengerWorkOtherOption.column.length-2].hide = true;
//        }
      },
      refreshList(){
          if(this.showType==1){
            this.getSwStInputPassengerWorkCash();
          }else if(this.showType==2){
            this.getSwStInputPassengerWorkElectron();
          }else if(this.showType==3){
            this.getSwStInputPassengerWorkPay();
          }else if(this.showType==4){
            this.getSwStInputPassengerWorkSpecial();
          }else if(this.showType==5){
            this.getSwStInputPassengerWorkFree();
          }else if(this.showType==6){
            this.getSwStInputPassengerWorkRefund();
          }else if(this.showType==7){
            this.getSwStInputPassengerWorkTicket(this.operationType);
          }else if(this.showType==8){
            this.getSwStInputPassengerWorkOther();
          }

      },
      async addReport(type) {
        if(this.selectKeys.length<=0 || this.selectKeys.length>1){
          this.$message.warning("请选择要加入的数据并且只选择一条！");
          return;
        }
	/*
        if(3!=this.selectKeys[0].auditStatus){
          this.$message.warning("请选择审批未通过数据加入！");
          return;
        }*/
        this.selectKeys[0].reportNameId = '1';
        let param={};
        if([1,2,6,3,4,5].indexOf(type)>=0){
          param={
            lineCode:this.$parent.rowData.lineCode,
            stationCode:this.$parent.rowData.stationCode,
            reprotTime:this.$parent.rowData.workDate,
            reportNameId:2,
            userCodes:this.$parent.rowData.conductorCode,
            showType:3,
            dataSource:6,
          };
        }else if([8].indexOf(type)>=0){ //其它
          param={
            lineCode:this.$parent.rowData.lineCode,
            stationCode:this.$parent.rowData.stationCode,
            reprotTime:this.selectKeys[0].inputTime,
            reportNameId:10,
            userCodes:this.$parent.rowData.conductorCode,
            showType:3,
            dataSource:7,
          };
        }else if([7].indexOf(type)>=0){ //非即使
          param={
            lineCode:this.$parent.rowData.lineCode,
            stationCode:this.$parent.rowData.stationCode,
            reprotTime:this.$parent.rowData.workDate,
            userCodes:this.$parent.rowData.conductorCode,
            showType:3,
          };
          if(this.title == '非即时退换票'){
            param.reportNameId=9;
            param.dataSource=9;
          }else if(this.title == '即时退换票'){
            param.reportNameId=3;
            param.dataSource=8;
          }
        }
        param.deviceNo=this.$parent.rowData.deviceOperateNum;
        param.bomCode=this.$parent.rowData.bomCode;
        param.resultIds=this.selectKeys[0].id;
        switch (type) {
          case 1:
            param.operatorTable="sw_st_input_passenger_work_cash";
            param.errorAmount=numToTwoPoint(this.selectKeys[0].amount)-numToTwoPoint(this.selectKeys[0].auditAmount);
            break;
          case 2:
            param.operatorTable="sw_st_input_passenger_work_electron";
            param.errorAmount=numToTwoPoint(this.selectKeys[0].amount)-numToTwoPoint(this.selectKeys[0].auditAmount);
            break;
          case 3:
            param.operatorTable="sw_st_input_passenger_work_pay";
            param.errorAmount=numToTwoPoint(this.selectKeys[0].amount)-numToTwoPoint(this.selectKeys[0].auditAmount);
            break;
          case 4:
            param.operatorTable="sw_st_input_passenger_work_special";
            param.errorAmount=numToTwoPoint(this.selectKeys[0].amount)-numToTwoPoint(this.selectKeys[0].auditAmount);
            break;
          case 5:
            param.operatorTable="sw_st_input_passenger_work_free";
            break;
          case 6:
            param.operatorTable="sw_st_input_passenger_work_refund";
            param.errorAmount=numToTwoPoint(this.selectKeys[0].amountRefunded)-numToTwoPoint(this.selectKeys[0].auditAmount);
            break;
          case 7:
            param.operatorTable="sw_st_input_passenger_work_ticket";
            param.errorAmount=numToTwoPoint(this.selectKeys[0].amount)-numToTwoPoint(this.selectKeys[0].auditAmount);
            break;
          case 8:
            param.operatorTable="sw_st_input_passenger_work_other";
            param.errorAmount=numToTwoPoint(this.selectKeys[0].amount)-numToTwoPoint(this.selectKeys[0].auditAmount);
            break;
        }

        this.$refs.addReportEditor.others_report_add_call(param);

      },
      close(){
        this.$parent.isTransactionAudit=false;
      },
      selectionChange(list){
        this.selectKeys=list;
        this.selectKeyVals=[];
        for(let i=0;i<list.length;i++){
          this.selectKeyVals.push(list[i].id);
        }
      }
    }
  }
</script>
